import Vue from 'vue'
import Router from 'vue-router'
import Construct from "@/view/Construct.vue";

Vue.use(Router)
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [
  {
    path: '/',
    component: () => import('../view/Manage.vue'),
    redirect: "/login"
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../view/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../view/Register.vue')
  },
  {
    path: '/manage',
    name: 'Manage',
    component: () => import('../view/Manage.vue')
  },
  {
    path: '/role',
    name: 'Role',
    component: () => import('../view/Role.vue')
  },
  {
    path: '/construct',
    name: 'Construct',
    component: () => import('../view/Construct.vue')
  }
]

const router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

//路由守卫

export default router
